﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PersonalWebsite.Domain.Abstract.Configuration;
using PersonalWebsite.Domain.Entities.Website;

namespace PersonalWebsite.Domain.Configurations.Website
{
    public class WS_ProjectConfiguration : BaseConfiguration<WS_Project>
    {
        public override void Configure(EntityTypeBuilder<WS_Project> builder)
        {

            builder.ToTable(nameof(WS_Project));

            builder.Property(c => c.Name).HasComment(comment: "项目名称").IsRequired().HasMaxLength(20);
            builder.Property(c => c.Category).HasComment("类型").IsRequired();
            builder.Property(c => c.Desc).HasComment("项目描述").HasMaxLength(500).IsRequired(true);
            builder.Property(c => c.Link).IsUnicode(false).HasComment("项目地址").HasMaxLength(1000).IsRequired(true);

            builder.HasIndex(c => c.Category);

            base.Configure(builder);
        }
    }
}
